#include <stdio.h>
#include <string.h>
#define BUFFER_SIZE 16

int main()
{
 #if 0
    /*
    char *ptr;//野指针,会乱七八糟的，对应的地址也是
    */
    char *ptr = NULL;//避免野指针，所以要给指针赋值
    char *ptr1 = "hello word";
    int len =  sizeof(ptr1);   //为什么是8
    printf("len:%d\n",len);

             //前面加*号的就是指针,只要是指针类型其占用内存大小为8
    int a = 5;
    int *pa = &a;
    len = sizeof(pa);
    printf("len:%d\n",len);

    short b = 10;
    short *pb = &b;
    len = sizeof(pb);
    printf("len:%d\n",len);
#endif

#if 0
    //字符串指针的赋值
    char *ptr = "hello world";
    len = strlen(ptr); //字符串操作函数：strlen
    printf("len:%d\n",len);

#endif
    

    #if 1
    //字符串是由字符构成的
    char buffer[] = "hello worid";
    for(int idx = 0; idx < sizeof(buffer); idx++)
    {
        printf("buffer[%d]=%c\n", idx ,buffer[idx] );
    }

    #endif
return 0;

}





